package cn.xaut.剑指offer.m10;

import java.util.Arrays;

/**
 * 剑指 Offer 17. 打印从1到最大的n位数
 */
public class demo17 {

    public int[] printNumbers(int n) {

        int max = (int) Math.pow(10, n);
        int[] res = new int[max - 1];
        for (int i = 1; i < max; i++) {
            res[i - 1] = i;
        }
        return res;
    }

    public static void main(String[] args) {

        System.out.println(Arrays.toString(new demo17().printNumbers(1)));
        System.out.println(Arrays.toString(new demo17().printNumbers(2)));
        System.out.println(Arrays.toString(new demo17().printNumbers(3)));
    }
}
